using System;
using System.Collections.Generic;
using System.Text;
using CodeStory.Core.UI;
using CodeStory.Gallery.ObjectBusiness;
using CodeStory.Gallery.ObjectEntity;
using System.Web.UI.WebControls;
using CodeStory.Core;

namespace CodeStory.Gallery.Portlets
{
	[NavigationPortlet("CodeStory_Gallery_FolderPhotos")]
	public class FolderPhotos : Portlet
	{
		protected global::System.Web.UI.WebControls.DataList dlPhotos;

		protected override void OnInit(EventArgs e) {
			Load += new EventHandler(FolderPhotos_Load);
			base.OnInit(e);
		}

		void FolderPhotos_Load(object sender, EventArgs e) {
			//throw new Exception("The method or operation is not implemented.");
			if (!IsPostBack) {
				BindPhotos();
			}
		}

		private void BindPhotos() {
			string folderid = Request.QueryString["folderid"];
			if (string.IsNullOrEmpty(folderid)) return;
			IEnumerable<GalleryPhotoObject> list = GalleryPhotoBusiness.ListPhotosInFolder(folderid);

			dlPhotos.DataSource = list;
			dlPhotos.DataBind();
		}
	}
}
